/*
 * Copyright (C) 2015 soud
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#ifndef PARSER_H
#define PARSER_H

#include "lexer.h"
#include "token.h"
#include "ast.h"
#include "stack.h"

#define parser_file_error(...) do { \
                                       PARSE_FAILED = true; \
                                       error_printf(TARGET_FILE, ##__VA_ARGS__); \
                               } while(0);

#define INT_KEYWORD    "Int"
#define I8_KEYWORD     "Int8"
#define I16_KEYWORD    "Int16"
#define I32_KEYWORD    "Int32"
#define I64_KEYWORD    "Int64"
#define U8_KEYWORD     "Int8"
#define U16_KEYWORD    "UInt16"
#define U32_KEYWORD    "UInt32"
#define U64_KEYWORD    "UInt64"
#define STRING_KEYWORD "Str"
#define CHAR_KEYWORD   "Char"
#define BOOL_KEYWORD   "Bool"
#define FLOAT_KEYWORD  "Float"
#define F32_KEYWORD    "Float32"
#define F64_KEYWORD    "Float64"
#define NONE_KEYWORD   "None"

extern bool PARSE_FAILED;

ast_node_list_t *parse_token_stream(token_t *ts);

#endif /* !PARSER_H */
